//
//  NetworkTools.m
//  1-MushroomStreet-自定义tabbar
//
//  Created by xmg on 16/1/27.
//  Copyright © 2016年 grx. All rights reserved.
//

#import "NetworkTools.h"
@implementation NetworkTools
SingleM(NetworkTools)


//向服务器请求数据
+ (void)loadDataFromServerWithPath:(NSString *)pathString parameters:(id)parameters  resultObject:(void(^)(id responseObject))resultObject{
    NSURL *url = [NSURL URLWithString:@"https://api.weibo.com/"];
    
    NetworkTools *tools = [[NetworkTools alloc] initWithBaseURL:url];
    
    tools.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/plain", nil];
    
    [tools GET:pathString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        resultObject(responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        return ;
    }];
    
}

@end
